negotiator.protocol.alternatingoffers
Class AlternatingOffersBilateralAtomicNegoSession

java.lang.Object
  extended by negotiator.protocol.BilateralAtomicNegotiationSession
      extended by negotiator.protocol.alternatingoffers.AlternatingOffersBilateralAtomicNegoSession
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
AuctionBilateralAtomicNegoSession

public class AlternatingOffersBilateralAtomicNegoSession
extends BilateralAtomicNegotiationSession

This is an updated version which has shared deadlines for both agents, implemented with Timeline.


Field Summary
 Agent currentAgent
           
 java.util.ArrayList<NegotiationOutcome> MACoutcomes
           
 NegotiationOutcome no
           
protected  Protocol protocol
           
protected  java.lang.String startingAgent
           
protected  boolean startingWithA
           
protected  java.util.Date startTime
           
protected  long startTimeMillies
           
 boolean stopNegotiation
          stopNegotiation indicates that the session has now ended.
protected  java.lang.Integer totalTime
          Default setting is 3min.
 
Fields inherited from class negotiator.protocol.BilateralAtomicNegotiationSession
additionalLog, agentA, agentAname, agentAparams, agentB, agentBname, agentBparams, bidSpace, fAgentABids, fAgentBBids, finalRound, lastAction, lastBid, matchDataLogger, omMeasuresResults, spaceA, spaceB
 
Constructor Summary
AlternatingOffersBilateralAtomicNegoSession(Protocol protocol, Agent agentA, Agent agentB, java.lang.String agentAname, java.lang.String agentBname, UtilitySpace spaceA, UtilitySpace spaceB, java.util.HashMap<AgentParameterVariable,AgentParamValue> agentAparams, java.util.HashMap<AgentParameterVariable,AgentParamValue> agentBparams, java.lang.String startingAgent)
          load the runtime objects to start negotiation
 
Method Summary
protected  void badOutcome(double time, java.lang.String logMsg)
          Creates a bad Outcome, which is an outcome with an error
protected  void checkAgentActivity(Agent agent)
          This is the running method of the negotiation thread.
protected  void createBadMACOutcomes()
           
protected  void createMACOutcomes(double time)
          Creates the different outcomes for an agent that is using a MAC Calls createOutcome which actually creates the outcome to be logged.
 void createOutcome(Bid lastBid, double time, boolean isMac, OutcomeTuple outcomeTuple, java.lang.String acceptedBy)
          Creates an actual outcome object that can be logged
 NegotiationOutcome getNegotiationOutcome()
           
 java.lang.String getStartingAgent()
           
 void JudgeTimeout()
          This is called whenever the protocol is timed-out.
 Agent otherAgent(Agent ag)
           
 void run()
          a parent thread will call this via the Thread.run() function.
 void setStartingWithA(boolean val)
           
 void setTotalTime(int val)
           
 
Methods inherited from class negotiator.protocol.BilateralAtomicNegotiationSession
addAdditionalLog, addNegotiationEventListener, fireLogMessage, fireNegotiationActionEvent, fireNegotiationActionEvent, getAgentA, getAgentABids, getAgentAname, getAgentAparams, getAgentAUtilitySpace, getAgentB, getAgentBBids, getAgentBname, getAgentBparams, getAgentBUtilitySpace, getLastBid, getLog, getNegotiationPathA, getNegotiationPathB, getNrOfBids, getOpponentUtility, getOpponentWeight, getTestNumber, getTournamentNumber, removeNegotiationEventListener, setLog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stopNegotiation

public boolean stopNegotiation
stopNegotiation indicates that the session has now ended. it is checked after every call to the agent, and if it happens to be true, session is immediately returned without any updates to the results list. This is because killing the thread in many cases will return Agent.getAction() but with a stale action. By setting stopNegotiation to true before killing, the agent will still immediately return.


no

public NegotiationOutcome no

startingAgent

protected java.lang.String startingAgent

startingWithA

protected boolean startingWithA

startTime

protected java.util.Date startTime

startTimeMillies

protected long startTimeMillies

totalTime

protected java.lang.Integer totalTime
Default setting is 3min. This is the number of ms.


protocol

protected Protocol protocol

currentAgent

public Agent currentAgent

MACoutcomes

public java.util.ArrayList<NegotiationOutcome> MACoutcomes
Constructor Detail

AlternatingOffersBilateralAtomicNegoSession

public AlternatingOffersBilateralAtomicNegoSession(Protocol protocol,
                                                   Agent agentA,
                                                   Agent agentB,
                                                   java.lang.String agentAname,
                                                   java.lang.String agentBname,
                                                   UtilitySpace spaceA,
                                                   UtilitySpace spaceB,
                                                   java.util.HashMap<AgentParameterVariable,AgentParamValue> agentAparams,
                                                   java.util.HashMap<AgentParameterVariable,AgentParamValue> agentBparams,
                                                   java.lang.String startingAgent)
                                            throws java.lang.Exception
load the runtime objects to start negotiation

Throws:
java.lang.Exception
Method Detail

run

public void run()
a parent thread will call this via the Thread.run() function. Then it will start a timer to handle the time-out of the negotiation. At the end of this run, we will notify the parent so that he does not keep waiting for the time-out.


badOutcome

protected void badOutcome(double time,
                          java.lang.String logMsg)
                   throws java.lang.Exception
Creates a bad Outcome, which is an outcome with an error

Throws:
java.lang.Exception

createMACOutcomes

protected void createMACOutcomes(double time)
                          throws java.lang.Exception
Creates the different outcomes for an agent that is using a MAC Calls createOutcome which actually creates the outcome to be logged.

Throws:
java.lang.Exception

createBadMACOutcomes

protected void createBadMACOutcomes()

checkAgentActivity

protected void checkAgentActivity(Agent agent)
This is the running method of the negotiation thread. It contains the work flow of the negotiation.


otherAgent

public Agent otherAgent(Agent ag)

JudgeTimeout

public void JudgeTimeout()
This is called whenever the protocol is timed-out. What happens in case of a time-out is (1) the sessionrunner is killed with a Thread.interrupt() call from the NegotiationSession2. (2) judgeTimeout() is called.


createOutcome

public void createOutcome(Bid lastBid,
                          double time,
                          boolean isMac,
                          OutcomeTuple outcomeTuple,
                          java.lang.String acceptedBy)
                   throws java.lang.Exception
Creates an actual outcome object that can be logged

Throws:
java.lang.Exception

getNegotiationOutcome

public NegotiationOutcome getNegotiationOutcome()

getStartingAgent

public java.lang.String getStartingAgent()
Specified by:
getStartingAgent in class BilateralAtomicNegotiationSession

setStartingWithA

public void setStartingWithA(boolean val)

setTotalTime

public void setTotalTime(int val)